<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<% if (session.getAttribute("sUsuario") != null) {
        response.sendRedirect(getServletContext().getContextPath());
    }
    response.addHeader("Cache-Control", "max-age = 0, s-maxage = 0,must-revalidate, proxy-revalidate, no-cache, no-store ");
    response.addHeader("Pragma", "no-cache");%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="author" content="Moises Canche Tzab - Sybil Integraciones TI">
        <link rel="shortcut icon" href="images/favico.ico" >
        <script type="text/javascript" src="js/jquery-1.9.1.js"></script>
        <title>CYM - Login</title>
        <style type="text/css">
            body {font-size: 8pt;font-family: Arial,Helvetica,sans-serif;padding: 0;margin: 0;
                  background-color: #DDE1E4;background-image: url('images/fondo.jpg');background-repeat:no-repeat;
                  background-attachment:fixed;background-position:center;}
            #login_div {
                position: absolute; top: 50%; left: 30%; padding: 5%; margin: 5%;
            }
        </style>
        <script type='text/javascript'>
            $.ajaxSetup({cache: false});
            $(document).ready(function() {
                $('#login').focus();
            });
            function validar() {
                if (document.getElementById("login").value.length < 3 ) {
                    alert("Introduce tu usuario");
                    document.getElementById("login").focus();
                    return false;
                }
                if (document.getElementById("contrasena").value.length < 3) {
                    alert("Ingresa tu Contraseña");
                    document.getElementById("contrasena").focus();
                    return false;
                }
                return true;
            }
        </script>
    </head>
    <body>
        <!--[if lt IE 7]>
        <p class="chromeframe">You are using an outdated browser. 
        <a href="http://browsehappy.com/">Upgrade your browser today</a> 
        or <a href="http://www.google.com/chromeframe/?redirect=true">
        install Google Chrome Frame</a> 
        to better experience this site.</p>
        <![endif]-->
        <div id="login_div">
            <form action="usu" id="frm_login" method="post" onsubmit="return validar();">
                <table border="0" cellpadding="0" cellspacing="1">
                    <tr>
                        <td><strong>Usuario: </strong></td>
                        <td><input type="hidden" name="ac" value="lg">
                            <input type="text" name="login" id="login" size="20"
                                   value="<%=request.getParameter("login") == null ? ""
                                           : request.getParameter("login")%>"
                                   placeholder="Usuario..."/>
                        </td>
                    </tr>
                    <tr>
                        <td><strong>Contrase&ntilde;a: </strong></td>
                        <td>
                            <input type="password" name="contrasena" id="contrasena"  size="20"
                                   value="<%=request.getParameter("contrasena") == null ? ""
                                           : request.getParameter("contrasena")%>"
                                   placeholder="Contraseña..."/>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" colspan="2">
                            <input type="submit" value="Entrar"/>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" colspan="2">
                            <%=request.getAttribute("error") == null ? ""
                                    : request.getAttribute("error")%>
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </body>
</html>